import {request} from "@api/axios/request"
export const useApi=(modular,centrer)=>{
    //RHISCenterAxios.defaults.baseURL =ApiJson.RHISCenter;
    const RHISCenterAxios=request(centrer)
    const apiModel={};
    apiModel[modular+'Model']={};
    apiModel[modular+'TableData']=[];
    apiModel[modular+'Add']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/Add`,params)
    };
    apiModel[modular+'Adds']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/Adds`,params)
    };
    apiModel[modular+'Edit']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/Edit`,params)
    };
    apiModel[modular+'DynamicEdit']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/DynamicEdit`,params)
    };
    apiModel[modular+'SoftDel']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/SoftDel`,params)
    };
    apiModel[modular+'SoftDels']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/SoftDels`,params)
    };
    apiModel[modular+'Del']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/Del`,params)
    };
    apiModel[modular+'Dels']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/Dels`,params)
    };
    apiModel[modular+'RestoreSoftDel']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/RestoreSoftDel`,params)
    };
    apiModel[modular+'Search']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/Search`,params)
    };
    apiModel[modular+'SearchSoftDel']=(params)=>{
        return RHISCenterAxios.get(`api/${modular}/SearchSoftDel`,{params})
    };
    apiModel[modular+'MoveUpAndDown']=(params)=>{
        return RHISCenterAxios.post(`api/${modular}/MoveUpAndDown`,params)
    };
    return apiModel
}